<template>
  <div class="home_cydn">
    <div class="cydn_content">
      <div class="cydn_content_header">
        <div class="cydn_content_header_top">
          <!-- <div class="cydn_top_left"> -->
          <div class="head_left">
            <a style="float:left;cursor: pointer;color: #ffffff;display:flex" @click="goBack()">
              <img src="@/assets/img/lclb/LOGO.png"
                    class="cydn_top_left_img"
                    style="margin-left: 0;float:left"
                    alt=""
                    width="38px"
                    height="37px">
              <div style="float:right;height:37px;line-height:37px">数字经济综合应用</div>
            </a>
            <div class="titleButton">政府侧</div>
          </div>
          <div class="head_right">
            <div class="numberzj">数字浙江</div>
            <i class="el-icon-user-solid" style="font-size: 24px;margin-right: 8px"></i>
            <span v-if="zfName !== null && zfName !== undefined && zfName !== ''">{{zfName}}，你好</span>
            <span v-else>你好</span>
            <!-- <i class="el-icon-switch-button" style="margin-left: 18px;cursor: pointer;font-size: 24px;margin-right: 8px"></i> -->
          </div>
        </div>
      </div>
      <div class="cydn_content_header_title">
        <el-breadcrumb separator-class="el-icon-arrow-right" id="breadcrumb2">
          <el-breadcrumb-item>
            <!-- <a href="https://detest.jxt.zj.gov.cn/web-company-pc-v1/index.html#/view/card?type=%E7%9F%B3%E6%B2%B9%E5%8C%96%E5%B7%A5">首页</a> -->
            <a  @click="goBack()">首页</a>
          </el-breadcrumb-item>
          <el-breadcrumb-item>
            <!-- <a href="https://detest.jxt.zj.gov.cn/web-company-pc-v1/index.html#/view/card?type=%E7%9F%B3%E6%B2%B9%E5%8C%96%E5%B7%A5">化工</a> -->
            <a  @click="goBack()">产业大脑</a>
          </el-breadcrumb-item>
          <el-breadcrumb-item :class="routeName1 === ''?'noRouteName1':'noRouteName2'">
            <span @click="routeName1 === ''?'':goBack()">{{routeName}}</span>
          </el-breadcrumb-item>
          <el-breadcrumb-item>
            <span>{{routeName1}}</span>
          </el-breadcrumb-item>
          <el-breadcrumb-item style="float:right">
            <!-- <a href="https://detest.jxt.zj.gov.cn/web-company-pc-v1/index.html#/view/card?type=%E7%9F%B3%E6%B2%B9%E5%8C%96%E5%B7%A5">返回上级</a> -->
            <span @click="goBack()"><i class="el-icon-arrow-left" style="font-size: 14px;margin-right: 8px"></i>返回上级</span>
          </el-breadcrumb-item>
        </el-breadcrumb>
      </div>
      <div class="content_cydn">
        <div class="cydn_tabs" v-show="cydnTabs && cydnTabs.length">
          <div v-for="item in cydnTabs"
                :key="item.componentName"
                class="cydn_tabs_item"
                @click="jumpRoute(item.componentName)"
                v-show="!(item.show === false)"
                :class="{'cydn_tabs_item_choosed': $route.name===item.componentName}">
            {{item.name}}
          </div>
        </div>
        <div :class="{'cydn_panel':needPadding}">
          <slot></slot>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      routeName: sessionStorage.getItem('routeName'),
      routeName1: sessionStorage.getItem('routeName1'),
      zfName: sessionStorage.getItem('zfName'),
      goHomeUrl: '',
      // cydnTabs: [
      //   {
      //     name: '联储联备控制台',
      //     componentName: 'reserveIndex'
      //   },
      //   {
      //     name: '备件需求',
      //     componentName: 'spareRequirementsList'
      //   },
      //   {
      //     name: '备件库存',
      //     componentName: 'spareGoodsList'
      //   },
      //   {
      //     name: '备件领用',
      //     componentName: 'spareGetList'
      //   },
      //   {
      //     name: '对账单',
      //     componentName: 'spareStatementList'
      //   }
      // ],
      // tabChoosed: 'reserveIndex'
    }
  },
  props: {
    cydnTabs: {
      type: Array,
      default: () => []
    },
    titleName: {
      type: String,
      default: ''
    },
    needPadding: {
      type: Boolean,
      default: true
    }
  },
  watch: {
    '$store.state.user.zfName': function () {
      this.$nextTick(() => {
        this.zfName = this.$store.state.user.zfName
        sessionStorage.setItem('zfName',this.$store.state.user.zfName)
      })
    }
  },
  methods: {
    jumpRoute (name) {
      if (name) {
        this.$router.push({
          name: name
        })
      }
    },
    goBack(){
      this.$router.go(-1)
    },
  },
  created () {
    if (window.location.href.indexOf('/#/zfSafetyProduction') !== -1) {
      sessionStorage.setItem('routeName', '生产安全')
      this.routeName = sessionStorage.getItem('routeName')
    } else if (window.location.href.indexOf('/#/zfEnergyConsumption') !== -1) {
      sessionStorage.setItem('routeName', '能源消耗')
      this.routeName = sessionStorage.getItem('routeName')
    } else if (window.location.href.indexOf('/#/zfEnvironmentalProtection') !== -1) {
      sessionStorage.setItem('routeName', '环境保护')
      this.routeName = sessionStorage.getItem('routeName')
    } else if (window.location.href.indexOf('/#/zfParkManagement') !== -1) {
      sessionStorage.setItem('routeName', '园区管理')
      this.routeName = sessionStorage.getItem('routeName')
    } else if (window.location.href.indexOf('/#/tanpaifang') !== -1) {
      sessionStorage.setItem('routeName', '碳排放')
      this.routeName = sessionStorage.getItem('routeName')
    } else if (window.location.href.indexOf('/#/zfDiagnosticEvaluation') !== -1) {
      sessionStorage.setItem('routeName', '智能制造诊断评估')
      this.routeName = sessionStorage.getItem('routeName')
    } else if (window.location.href.indexOf('/#/zfPerMuBenefit') !== -1) {
      sessionStorage.setItem('routeName', '亩均效益')
      this.routeName = sessionStorage.getItem('routeName')
    }
    // 测试
    // this.loginOutUrl = 'https://detest.jxt.zj.gov.cn/zlb_login_api/idass/user/loginOut?redirect_url=https%3A%2F%2Fdetest.jxt.zj.gov.cn%2Fweb-company-pc-v1%2Findex.html#/view/card?type=%E7%9F%B3%E6%B2%B9%E5%8C%96%E5%B7%A5'
    // this.goHomeUrl = 'http://39.105.241.68:8320/government/gov-chemical-engineering/gov-ce-home'

    // 生产
    // this.loginOutUrl = 'https://de-pc.jxt.zj.gov.cn/zlb_login_api/idass/user/loginOut?redirect_url=https://de-pc.jxt.zj.gov.cn/web-company-pc-v1/index.html#/view/card?type=%E7%9F%B3%E6%B2%B9%E5%8C%96%E5%B7%A5'
    // this.goHomeUrl = 'https://de-pc.jxt.zj.gov.cn/web-company-pc-v1/index.html#/view/card?type=%E7%9F%B3%E6%B2%B9%E5%8C%96%E5%B7%A5'
  },
  updated () {
    if (window.location.href.indexOf('/#/zfSafetyProductionDetail') !== -1) {
      this.routeName1 = sessionStorage.getItem('routeName1')
    } else if (window.location.href.indexOf('/#/zfEnergyConsumptionDetail') !== -1) {
      this.routeName1 = sessionStorage.getItem('routeName1')
    } else if (window.location.href.indexOf('/#/zfEnvironmentalProtectionDetail') !== -1) {
      this.routeName1 = sessionStorage.getItem('routeName1')
    } else if (window.location.href.indexOf('/#/zfParkManagementDetail') !== -1) {
      this.routeName1 = sessionStorage.getItem('routeName1')
    } else {
      this.routeName1 = ''
      sessionStorage.setItem('routeName1','')
    }
  }
}
</script>
<style lang='scss' scoped>
.home_cydn {
  min-width: 1440px;
  background: url("~@/assets/img/zfbackground.png") no-repeat ;
  //background-position-y: -100px;
  background-size: 100%;
  // background-size: 100% 200px;
  // padding-top: 110px;
  .cydn_content {
    width: 100%;
    margin: 0 auto;
    .cydn_content_header{
      .cydn_content_header_top {
        width: 100%;
        height: 80px;
        padding-left: 37px;
        border-bottom: 1px solid hsla(0,0%,100%,.5);
        color: #ffffff;
        display: flex;
        align-items: center;
        justify-content: space-between;
        .head_left{
          font-size: 24px;
          font-weight: 550;
          letter-spacing: 5px;
          overflow: hidden;
          display: flex;
        }
        .head_right{
          float: right;
          padding-right: 41px;
          display: flex;
          align-items: center;
          font-size: 16px;
          color: #fff;
        }
        .cydn_top_left_img {
          margin-right: 6px;
          // margin-left: 25px;
        }
      }
    }
    .cydn_content_header_title {
      margin-top:35px;
      text-align: center;
      #breadcrumb2 {
        width: 80%;
        min-width: 1440px;
        height: 0.48rem;
        line-height: 0.48rem;
        margin: 0 auto;
        margin-bottom: 10px;
        background: #f8fcff;
        // box-shadow: 0 0.03rem 0.06rem 0 rgba(0, 0, 0, 0.07);
        box-sizing: border-box;
        padding: 0 0.28rem;
        position: relative;
        /deep/ .el-breadcrumb__item {
          font-size: 14px;
          color: #606266;
          font-weight: 500;
          .no-redirect {
            font-size: 16rem;
            color: #606266;
            text-align: center;
            font-weight: 400;
            cursor: text;
            // font-weight: bold;
            &.link {
              cursor: pointer;
            }
            &.active {
              font-weight: normal;
              color: #606266;
            }
          }
          .el-breadcrumb__separator{
            font-size: .1rem;
          }
        }
        /deep/ .el-breadcrumb__item .el-breadcrumb__inner a{
          font-weight: 500;
          color: #606266;
        }
        /deep/ .el-breadcrumb__item:last-child .el-breadcrumb__inner span{
          color: #606266;
          cursor: pointer;
          font-weight: 500;
        }
        /deep/ .noRouteName1 .el-breadcrumb__inner{
          color: #1492ff;
        }
        /deep/ .noRouteName2 .el-breadcrumb__inner{
          cursor: pointer;
        }
        /deep/ .noRouteName1 .el-icon-arrow-right{
          display: none;
        }
        /deep/ .el-breadcrumb__item:nth-child(4) .el-breadcrumb__inner{
          color: #1492ff;
        }
        /deep/ .el-breadcrumb__item:nth-child(4) .el-icon-arrow-right{
          display: none;
        }
      }
    }
    .content_cydn{
      width: 80%;
      min-width: 1440px;
      margin: 0 auto;
      // box-shadow: 0px 4px 9px 0px rgba(0, 0, 0, 0.15);
      background-color: rgba(255, 255, 255, 0.58);
      .panel_top{
        padding-top: 20px;
      }
      .cydn_panel{
        width: 100%;
        // min-width: 1440px;
      }
    }
  }
}

*,
*:before,
*:after {
  -webkit-box-sizing: border-box;

  -moz-box-sizing: border-box;

  box-sizing: border-box;
}

html,
body,
div,
dl,
dt,
dd,
ul,
ol,
li,
h1,
h2,
h3,
h4,
h5,
h6,
pre,
code,
form,
fieldset,
legend,
input,
textarea,
p,
blockquote,
th,
td,
hr,
button,
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section,
img {
  margin: 0px;

  padding: 0px;

  outline: none;

  border: 0px;
}

.backimg {
  height: 14px;
  width: 14px;
}
.text1 {
  display: inline-block;
  margin-left: 10px;
  font-size: 14px;
  color: #333333;
  cursor: pointer;
}
.el-dropdown-menu__item {
  padding: 0 10px;
}
.titleButton{
  border: 1px solid #ffffff;
  color: #ffffff;
  border-radius: 50px;
  font-size: 18px;
  font-weight: 400;
  margin-left: 10px;
  padding: 5px 20px;
  line-height: 32px;
  letter-spacing: 0;
}
.numberzj{
  border: 1px solid #ffffff;
  cursor: pointer;
  padding: 8px 18px;
  margin-right: 80px;
  font-size: 18px;
}
</style>
